package model

import (
	"time"
	"wzgames/internal/constant"
	"wzgames/internal/model/mcomm"
)

type SysContainer struct {
	CtId    int64            `db:"ctid"`
	Name    string           `db:"name"`
	Env     constant.EnvType `db:"env"`
	Status  mcomm.Status     `db:"status"`
	Remark  string           `db:"remark"`
	Created time.Time        `db:"created"`
	Updated time.Time        `db:"updated"`
}

type SysNode struct {
	NodeId   int64             `db:"nodeid"`
	CtId     int64             `db:"ctid"`
	NodeKey  string            `db:"nodekey"`
	Name     string            `db:"name"`
	Timezone string            `db:"tz"`
	Env      constant.EnvType  `db:"env"`
	Group    constant.NodeType `db:"group"`
	Status   mcomm.Status      `db:"status"`
	Remark   string            `db:"remark"`
	Created  time.Time         `db:"created"`
	Updated  time.Time         `db:"updated"`
}

type SysServ struct {
	ServID   int64             `db:"servid"`
	NodeId   int64             `db:"nodeid"`
	CtId     int64             `db:"ctid"`
	ServName string            `db:"name"`
	Addr     string            `db:"addr"`
	BindAddr string            `db:"bind"`
	Port     string            `db:"port"`
	CtPort   string            `db:"ctport"`
	BasePath string            `db:"path"`
	Mode     string            `db:"mode"`
	MaxQps   int64             `db:"qps"`
	Weight   int64             `db:"weight"`
	MetaData string            `db:"metadata"`
	Interval int64             `db:"interval"`
	AcKey    string            `db:"ackey"`
	Protocol constant.Protocol `db:"protocol"`
	Status   mcomm.Status      `db:"status"`
	Created  time.Time         `db:"created"`
	Updated  time.Time         `db:"updated"`
}

type SysNodeCluster struct {
	ClusterID   int64                `db:"clusterid"`
	ClusterName string               `db:"name"`
	LoadBalance constant.LoadBalance `db:"loadbalance"`
	Group       string               `db:"group"`
	ServIDs     string               `db:"servs"`
	Created     time.Time            `db:"created"`
	Updated     time.Time            `db:"updated"`
}

type SysCurrency struct {
	CurrId    int32              `db:"currid" json:"currid"`
	Name      string             `db:"name" json:"name"`
	Curr      string             `db:"curr" json:"curr"`
	CurrType  mcomm.CurrencyType `db:"currtype" json:"currtype"`
	Precision int32              `db:"precision" json:"precision"`
	Status    mcomm.Status       `db:"status" json:"status"`
	Created   time.Time          `db:"created" json:"created"`
	Updated   time.Time          `db:"updated" json:"updated"`
}

type SysLang struct {
	Name    string    `db:"name" json:"name"`
	Desc    string    `db:"desc" json:"desc"`
	Created time.Time `db:"created" json:"created"`
	Updated time.Time `db:"updated" json:"updated"`
}

type SysGame struct {
	GameId  int32        `db:"gameid" json:"gameid"`
	Name    string       `db:"name" json:"name"`
	GTag    string       `db:"gtag" json:"gtag"`
	Langs   string       `db:"langs" json:"langs"`
	Grp     int32        `db:"grp" json:"grp"`
	Status  mcomm.Status `db:"status" json:"status"`
	Created time.Time    `db:"created" json:"created"`
	Updated time.Time    `db:"updated" json:"updated"`
}

type SysGameCurrency struct {
	GcId     int64           `db:"gcid" json:"gcid"`
	GameId   int32           `db:"gameid" json:"gameid"`
	GameName string          `db:"gamename" json:"gamename"`
	CurrId   int32           `db:"currid" json:"currid"`
	Curr     string          `db:"curr" json:"curr"`
	VType    mcomm.ValueType `db:"vtype" json:"vtype"`
	Desc     string          `db:"desc" json:"desc"`
	Cfg      string          `db:"cfg" json:"cfg"`
	Status   mcomm.Status    `db:"status" json:"status"`
	Created  time.Time       `db:"created" json:"created"`
	Updated  time.Time       `db:"updated" json:"updated"`
}

type SysGameInst struct {
	InstId     int64        `db:"instid"`
	Name       string       `db:"name"`
	GameId     int32        `db:"gameid"`
	InstLinKey string       `db:"instlinkey"`
	Status     mcomm.Status `db:"status"`
	Remark     string       `db:"remark"`
	NodeTags   string       `db:"nodetags"`
	Cfg        []byte       `db:"cfg"`
	Created    time.Time    `db:"created"`
	Updated    time.Time    `db:"updated"`
}

type SysGameInstCurrency struct {
	InstId  int64     `db:"instid"`
	CurrId  int32     `db:"currid"`
	GcId    int64     `db:"gcid"`
	Created time.Time `db:"created"`
	Updated time.Time `db:"updated"`
}

type SysNodeBootHistory struct {
	NodeId   int64 `db:"nodeid"`
	Dateline int64 `db:"dateline"`
}
